package com.sky.controller.user;

import com.sky.constant.MessageConstant;
import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: ggm
 * @data 2024年11月12日 19:18
 */
@Slf4j
@RestController("UserShopController")
@RequestMapping("/user/shop")
public class ShopController {
    @Autowired
    private RedisTemplate redisTemplate;
    private static final String key = MessageConstant.SHOP_STATUS;

     /**
      * @Author: ggm
      * @date:  2024/12/9
      * 获取店铺营业状态
      */
     @GetMapping("/{status}")
     private Result<Integer> getStatus() {
         Integer status = (Integer) redisTemplate.opsForValue().get(key);
         log.info("营业状态为：{}", status == 1 ? "营业中" : "打烊中");
         return Result.success(status);
     }

}
